<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$return=array();
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('basic');
	if(!$_RQ['id']){
		exi('没有找到该项目，请重新选择！','error','jy_shopbaoxiu/sever/list');
	}
	//查询项目具体信息
	$serve=pdo_get('jy_shopbaoxiu_list',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_RQ['id']));
	//已支付，已确认，已完成订单数
	$num1=pdo_count('jy_shopbaoxiu_order',array('uniacid'=>$_SESSION['uniacid'],'pid'=>$_RQ['id'],'status'=>'1'));
	$num2=pdo_count('jy_shopbaoxiu_order',array('uniacid'=>$_SESSION['uniacid'],'pid'=>$_RQ['id'],'status'=>'2'));
	$num3=pdo_count('jy_shopbaoxiu_order',array('uniacid'=>$_SESSION['uniacid'],'pid'=>$_RQ['id'],'status'=>'4'));
	$serve['ordernum']=$num1+$num2+$num3;
	$return['banner']=$serve['hdps']?json_decode($serve['hdps'],true):$return['banner'];
	$return['serve']=$serve;
	$return['pid']=$serve['id'];
	$return['list']=array();
	set_html('title','项目评论');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$pid=$_RQ['pid']?intval($_RQ['pid']):$_SESSION['pid'];
	$params=array('pid'=>$pid,'show'=>1);
	$parameter['orderby']=array('star desc','id desc');
	$parameter=array(
		'params'=>$params,
	);
	$pindex = max(1, intval($page));
	$psize = $limit?:5;
	$parameter['limit']=array($pindex,$psize);
	$list=$this->pdo_getlist('comment',$parameter,$total);
	if($list){
			foreach($list as &$item){
				$item['member']=model('core/member')->detail($item['user_id'],array('nickname','avatar'));
				$item['member']['nickname']=$item['member']['nickname']?:'匿名用户';
				$item['images']=$item['images']?json_decode($item['images'],true):array();
				$item['createtime']=date('Y-m-d H:m:s',$item['createtime']);
			}
	}
	$return['list']=$list;
	exi($return);
}
?>